package day11.ThreadTest;

public class Test1 {
    public static void main(String[] args) {
        /*
        新建两个T1对象
        并分别启动
        线程启动后，自动执行run()方法代码

         */
        T1 t1 = new T1();
        T1 t2 = new T1();
        t1.start();
        t2.start();
    }
    static class T1 extends Thread{
        @Override
        public void run() {
            //获得线程名
            String n = getName();
            for (int i = 1; i <= 100; i++){
                System.out.println(
                        n+" - "+i
                );
            }

        }
    }
}
